import java.text.ParseException;
import java.util.List;

/**
 * Copyright © 2018胡建松. All rights reserved.
 *
 * @Package: PACKAGE_NAME
 * @author: hujiansong
 * @date: 2018/7/24 9:41
 * @version: V1.0
 */
public class App {
    public static void main(String[] args) {
        List<List<String>> connections = InputUtil.readFile();
        connections.forEach(connect->{
            Tree tree = new Tree(connect);
            try {
                System.out.println(tree.caculate());
            } catch (ParseException e) {
                e.printStackTrace();
            }
        });


    }
}
